During the process of fabricating a gate stack structure of a complementary metal-oxide-semiconductor (CMOS), tantalum nitride (TaN) is usually used as an etch stop layer to prevent from over-etching a work function metal layer. However, since the efficacy of using such etch stop layer to prevent from over-etching the work function metal layer is usually unsatisfied, a barrier layer underneath the etch stop layer may be lost. Under this circumstance, the performance, yield and reliability of the final product will be adversely affected.